import { GCellRenderer } from "../../../../../com/mui/controls/GCellRenderer";
import { SPetExploreCard } from "../../../../../Message/Public/SPetExploreCard";
import { ItemData } from "../../../resource/info/ItemData";
import { ItemMenuRegister } from "../../common/menu/ItemMenuRegister";
import { ItemMenuConst } from "../../common/menu/ItemMenuConst";
import { BaseItem } from "../../common/BaseItem";
//class PetExploreCardCellRenderer
    
    export  class PetExploreCardCellRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            this.setSize(32, 32);
            this.init();
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            this._card = arg1["card"] as SPetExploreCard;
            this._isShowMenu = arg1["isShowMenu"] as Boolean;
            this._baseItem.isShowLock = true;
            this._itemData = new ItemData(this._card.itemCode);
            this._baseItem.itemData = this._itemData;
            this._itemData.uid = this._card.uid;
            if (this._isShowMenu) 
            {
                if (this._itemData) 
                {
                    ItemMenuRegister.register(this._baseItem, this._itemData, ItemMenuConst.PetSkillCard);
                }
                else 
                {
                    ItemMenuRegister.unRegister(this._baseItem);
                }
            }
            return;
        }

        /* internal  */init(): void
        {
            this._baseItem = new BaseItem();
            this._baseItem.isDragAble = false;
            this._baseItem.isDropAble = false;
            this._baseItem.setSize(32, 32);
            this.addChild(this._baseItem);
            return;
        }

        /* internal */ /* var */_baseItem: BaseItem;

        /* internal */ /* var */_itemData: ItemData;

        /* internal */ /* var */_card: SPetExploreCard;

        /* internal */ /* var */_isShowMenu: Boolean;
    }
